package com.yanqu.road.server.cmd.activity.turtle;

import com.yanqu.road.message.YanQuMessage;
import com.yanqu.road.pb.activity.TurtleProto;
import com.yanqu.road.server.cmd.CrossCommand;
import com.yanqu.road.server.command.Cmd;
import com.yanqu.road.server.manager.turtle.CrossTurtleMgr;
import com.yanqu.road.server.protocol.Protocol;

import java.util.List;

/**
 * @Author : Cxp
 * @Time : 2024-09-11
 * @Description : 乌龟对对碰-跨服公告上传
 */

@Cmd(code = Protocol.C_TURTLE_UPLOAD_NOTICE, desc = "公告上传")
public class CrossTurtleUploadNoticeCmd extends CrossCommand {

    int activityId;

    private List<TurtleProto.TurtleNoticeDataTemp> noticeDataList;

    private long userId;

    @Override
    public boolean parseData(YanQuMessage packet) throws Exception {
        TurtleProto.CrossTurtleUploadNoticeReq reqMsg = TurtleProto.CrossTurtleUploadNoticeReq.parseFrom(packet.getBytes());
        activityId = reqMsg.getActivityId();
        noticeDataList = reqMsg.getNoticeDataList();
        userId = packet.getPlayerId();
        return true;
    }

    @Override
    public void execute(YanQuMessage packet) throws Exception {
        CrossTurtleMgr.addNotice(activityId, noticeDataList, userId);
    }

    @Override
    public void sendData() {

    }
}
